home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / Sample Code / Sample Editors⁄Viewers / Panel Editor / Source / UndoPE.cpp < prev    next >
Encoding:
Text File  |  1995-12-08  |  2.1 KB  |  95 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        UndoPE.h
  3.  
  4.     Contains:    Undo class implementation
  5.  
  6.     Written by:    Steve Smith
  7.     
  8.     Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  9. */
  10.  
  11. // -- Compiler/Preprocessor Switches --
  12.  
  13. #ifndef _COMPILERDEFS_
  14. #include "CompDefs.h"
  15. #endif
  16.  
  17. // -- PanelEditor Includes --
  18.  
  19. #ifndef _UNDOPE_
  20. #include "UndoPE.h"
  21. #endif
  22.  
  23. #ifndef _SAMPLECOLLECTIONS_
  24. #include "SampleCollections.h"
  25. #endif
  26.  
  27. #ifndef _LISTITEM_
  28. #include "ListItem.h"
  29. #endif
  30.  
  31. #pragma segment PanelEditorUndo
  32.  
  33. //------------------------------------------------------------------------------
  34. // Method:        Constructor
  35. //------------------------------------------------------------------------------
  36.  
  37. CUndo::CUndo()
  38. {
  39.     fType = kODNULL;
  40.     fSelection = kODNULL;
  41. }
  42.  
  43. //------------------------------------------------------------------------------
  44. // Method:        Destructor
  45. //------------------------------------------------------------------------------
  46.  
  47. CUndo::~CUndo()
  48. {
  49.     CListIterator fiter(fSelection);
  50.     for ( CListItem* item = (CListItem*)fiter.First();
  51.             fiter.IsNotComplete();
  52.             item = (CListItem*)fiter.Next() )
  53.     {
  54.         fiter.RemoveCurrent();
  55.         item->Release(somGetGlobalEnvironment());
  56.     }
  57. }
  58.  
  59. //------------------------------------------------------------------------------
  60. // Method:        SetType
  61. //------------------------------------------------------------------------------
  62.  
  63. void CUndo::SetType(ODUShort type)
  64. {
  65.     fType = type;
  66. }
  67.  
  68. //------------------------------------------------------------------------------
  69. // Method:        GetType
  70. //------------------------------------------------------------------------------
  71.  
  72. ODUShort CUndo::GetType()
  73. {
  74.     return fType;
  75. }
  76.  
  77. //------------------------------------------------------------------------------
  78. // Method:        SetSelection
  79. //------------------------------------------------------------------------------
  80.  
  81. void CUndo::SetSelection(CList* selection)
  82. {
  83.     fSelection = selection;
  84. }
  85.  
  86. //------------------------------------------------------------------------------
  87. // Method:        GetSelection
  88. //------------------------------------------------------------------------------
  89.  
  90. CList* CUndo::GetSelection()
  91. {
  92.     return fSelection;
  93. }
  94.  
  95.